/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package businessObjects;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author williamprado
 */
@Entity
@Table(name = "pautas")
@NamedQueries({
    @NamedQuery(name = "Pauta.findAll", query = "SELECT p FROM Pauta p"),
    @NamedQuery(name = "Pauta.findByIdPauta", query = "SELECT p FROM Pauta p WHERE p.idPauta = :idPauta"),
    @NamedQuery(name = "Pauta.findByFechaInicio", query = "SELECT p FROM Pauta p WHERE p.fechaInicio = :fechaInicio"),
    @NamedQuery(name = "Pauta.findByFechaFin", query = "SELECT p FROM Pauta p WHERE p.fechaFin = :fechaFin"),
    @NamedQuery(name = "Pauta.findByBanner", query = "SELECT p FROM Pauta p WHERE p.banner = :banner"),
    @NamedQuery(name = "Pauta.findByUrl", query = "SELECT p FROM Pauta p WHERE p.url = :url"),
    @NamedQuery(name = "Pauta.findByClicks", query = "SELECT p FROM Pauta p WHERE p.clicks = :clicks")})
public class Pauta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idPauta")
    private Integer idPauta;
    @Basic(optional = false)
    @Column(name = "fechaInicio")
    @Temporal(TemporalType.DATE)
    private Date fechaInicio;
    @Basic(optional = false)
    @Column(name = "fechaFin")
    @Temporal(TemporalType.DATE)
    private Date fechaFin;
    @Basic(optional = false)
    @Column(name = "banner")
    private String banner;
    @Column(name = "url")
    private String url;
    @Column(name = "clicks")
    private Integer clicks;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPauta")
    private Collection<Formulario> formularioCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idPauta")
    private Collection<Pago> pagoCollection;
    @JoinColumn(name = "loginCliente", referencedColumnName = "login")
    @ManyToOne(optional = false)
    private Cliente loginCliente;
    @JoinColumn(name = "idEsquema", referencedColumnName = "idEsquema")
    @ManyToOne(optional = false)
    private Esquema idEsquema;
    @JoinColumn(name = "idEstado", referencedColumnName = "idEstado")
    @ManyToOne(optional = false)
    private Estado idEstado;

    public Pauta() {
    }

    public Pauta(Integer idPauta) {
        this.idPauta = idPauta;
    }

    public Pauta(Integer idPauta, Date fechaInicio, Date fechaFin, String banner) {
        this.idPauta = idPauta;
        this.fechaInicio = fechaInicio;
        this.fechaFin = fechaFin;
        this.banner = banner;
    }

    public Integer getIdPauta() {
        return idPauta;
    }

    public void setIdPauta(Integer idPauta) {
        this.idPauta = idPauta;
    }

    public Date getFechaInicio() {
        return fechaInicio;
    }

    public void setFechaInicio(Date fechaInicio) {
        this.fechaInicio = fechaInicio;
    }

    public Date getFechaFin() {
        return fechaFin;
    }

    public void setFechaFin(Date fechaFin) {
        this.fechaFin = fechaFin;
    }

    public String getBanner() {
        return banner;
    }

    public void setBanner(String banner) {
        this.banner = banner;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getClicks() {
        return clicks;
    }

    public void setClicks(Integer clicks) {
        this.clicks = clicks;
    }

    public Collection<Formulario> getFormularioCollection() {
        return formularioCollection;
    }

    public void setFormularioCollection(Collection<Formulario> formularioCollection) {
        this.formularioCollection = formularioCollection;
    }

    public Collection<Pago> getPagoCollection() {
        return pagoCollection;
    }

    public void setPagoCollection(Collection<Pago> pagoCollection) {
        this.pagoCollection = pagoCollection;
    }

    public Cliente getLoginCliente() {
        return loginCliente;
    }

    public void setLoginCliente(Cliente loginCliente) {
        this.loginCliente = loginCliente;
    }

    public Esquema getIdEsquema() {
        return idEsquema;
    }

    public void setIdEsquema(Esquema idEsquema) {
        this.idEsquema = idEsquema;
    }

    public Estado getIdEstado() {
        return idEstado;
    }

    public void setIdEstado(Estado idEstado) {
        this.idEstado = idEstado;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPauta != null ? idPauta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pauta)) {
            return false;
        }
        Pauta other = (Pauta) object;
        if ((this.idPauta == null && other.idPauta != null) || (this.idPauta != null && !this.idPauta.equals(other.idPauta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "businessObjects.Pauta[idPauta=" + idPauta + "]";
    }

}
